from flask import Flask
from flask_restful import reqparse
from flask_restful import Api, Resource, reqparse, abort

app = Flask(__name__)
api = Api(app)

parser = reqparse.RequestParser()
parser.add_argument('name', type=str)

USER_LIST = {
    1: {'name': 'Michael'},
    2: {'name': 'Tom'},
}


class User(Resource):
    def put(self, user_id):
        args = parser.parse_args(strict=True)
        USER_LIST[user_id] = {'name': args['name']}
        return USER_LIST[user_id]


api.add_resource(User, '/users/<int:user_id>')

if __name__ == '__main__':
    app.run(host='0.0.0.0', debug=True)
